#
person = {
    'name': 'name1',
    'gender': 'nan',
    'age': 21
}
print(person, type(person))

book = {
    'title': 'python',
    'price': 49.9,
    'author': 'xiaoding',
    'pub': 'huadong',
    'pubtime': '2024-10-1'
}
print(book)
phone = {
    'brand': 'phonename',
    'color': 'bule',
    'price': 5000,
    'size': '12*12',
    'memory': 4069,
    'cpu': 2
}
print(phone)
#
print(phone['price'], phone.get('price'))
print(phone.get('disk'))
print(phone.get('disk', '256GB'))
print('brand' in phone)

#
# print(person.keys())
# print(person.values())
# print(person.items())

#
for k in person.keys():
    print(k, person[k])
for v in person.values():
    print(v)
for item in person.items():
    print(item)

student = {
    'yuwen': 67,
    'shuxue': 89,
    'yinyu': 89
}
total = 0
for v in student.values():
    total += v
print(total)

#
print(book)
book['price'] = 78
print(book)
book['is_onsale'] = True
print(book)
book.update({'price': 67, 'is_onsale': False})
print(book)

#
# del book['author']
# print(book)
# book.pop('pub')
# print(book)
# book.clear()
# print(book)

#
print(len(book))



